package com.hjjt.baselib.util

import android.content.Context
import com.hjjt.baselib.util.ImageUtil.convertGreyImg
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
import android.graphics.Bitmap
import java.security.MessageDigest

class GreyPicTransform() : BitmapTransformation() {
    override fun updateDiskCacheKey(messageDigest: MessageDigest) {

    }

    override fun transform(
        pool: BitmapPool,
        toTransform: Bitmap,
        outWidth: Int,
        outHeight: Int
    ): Bitmap {
        //这里就是上面我们写的工具类方法
        return convertGreyImg(toTransform)
    }

    //返回string就行，Glide加载图片的tag，一定要复写这个方法，并有返回值
    val id: String
        get() =//返回string就行，Glide加载图片的tag，一定要复写这个方法，并有返回值
            "grey"
}